//
//  ImageShowViewController.m
//  Comma
//
//  Created by liuyunqing on 15/1/29.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ImageShowViewController.h"
#import "ImageShowView.h"
#import "GlobalMacro.h"
#import "UIImageView+WebCache.h"
#import "YRSideViewController.h"
@interface ImageShowViewController () <UIScrollViewDelegate>

@end

@implementation ImageShowViewController

- (void)loadView
{
    [super loadView];
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
    scrollView.delegate = self;
    scrollView.bounces = NO;
    scrollView.maximumZoomScale = 2.0;
    scrollView.minimumZoomScale = 1;
    [self.view addSubview:scrollView];
    
    self.imageShowView = [[ImageShowView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    [_imageShowView setBackgroundColor:BLACKCOLOR];
    [scrollView addSubview:_imageShowView];
    
    // 不能划出侧边栏
    YRSideViewController *slide = [YRSideViewController share];
    slide.needSwipeShowMenu = NO;
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return scrollView.subviews.firstObject;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.imageShowView.imageShow sd_setImageWithURL:[NSURL URLWithString:self.imgUrl]];
    [self.imageShowView.backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    // Do any additional setup after loading the view.
}

- (void)backButtonAction:(UIButton *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
